home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / tcl / doc / TildeSubst.3 < prev    next >
Text File  |  1993-02-14  |  2KB  |  57 lines

  1. '\"
  2. '\" Copyright 1989 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. .so man.macros
  11. .HS Tcl_TildeSubst tcl
  12. .BS
  13. .SH NAME
  14. Tcl_TildeSubst \- replace tilde with home directory in a file name
  15. .SH SYNOPSIS
  16. .nf
  17. \fB#include <tcl.h>\fR
  18. .sp
  19. char *
  20. \fBTcl_TildeSubst\fR(\fIinterp\fR, \fIname\fR)
  21. .SH ARGUMENTS
  22. .AS Tcl_Interp *interp
  23. .AP Tcl_Interp *interp in
  24. Interpreter in which to report an error, if any.
  25. .AP char *name in
  26. File name, which may start with a ``~''.
  27. .BE
  28.  
  29. .SH DESCRIPTION
  30. .PP
  31. This utility procedure does tilde substition.  If \fIname\fR doesn't
  32. start with a ``~'' character, then the procedure returns \fIname\fR.
  33. If \fIname\fR does start with a tilde, then \fBTcl_TildeSubst\fR
  34. returns a new string identical to \fIname\fR except that the first
  35. element of \fIname\fR is replaced with the location of the home
  36. directory for the given user.  The substitution is carried out in
  37. the same way that it would be done by \fIcsh\fR.  If the tilde is
  38. followed immediately by a slash, then the \fB$HOME\fR environment
  39. variable is substituted.  Otherwise the characters between the
  40. tilde and the next slash are taken as a user name, which is
  41. looked up in the password file;  the user's home directory is
  42. retrieved from the password file and substituted.
  43. .PP
  44. The string returned by \fBTcl_TildeSubst\fR is a static string
  45. belonging to \fBTcl_TildeSubst\fR.  Its value will only persist
  46. until the next call to \fBTcl_TildeSubst\fR;  the caller should
  47. make a copy of the result if it needs to live a long time.
  48. .PP
  49. If an error occurs (e.g. because there was no user by the given
  50. name) then NULL is returned and an error message will be left
  51. at \fIinterp->result\fR.  It is assumed that \fIinterp->result\fR
  52. has been initialized in the standard way when \fBTcl_TildeSubst\fR
  53. is invoked.
  54.  
  55. .SH KEYWORDS
  56. file name, home directory, tilde, user
  57.